﻿using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
using PMIS.BLL;
using PMIS.BLL.Department;
using PMIS.BLL.User;
using PMIS.UI.Department;

namespace PMIS.UI.User
{
	/// <summary>
	/// 人员信息维护
	/// </summary>
	public partial class 人员信息维护 : BaseForm
	{
		#region 私有变量
		/// <summary>
		/// 当前操作的记录
		/// </summary>
		private 人员 CurrentRecord = null;
		/// <summary>
		/// 标识当前记录是否只读
		/// </summary>
		private bool IsCurrentRecordReadonly = true;
		#endregion

		#region 单例
		/// <summary>
		/// 本类的实例
		/// </summary>
		private static 人员信息维护 _form = null;
		/// <summary>
		/// 用于本类实现单例的Locker
		/// </summary>
		private static object locker = new object();
		/// <summary>
		/// 构造函数
		/// </summary>
		private 人员信息维护()
		{
			InitializeComponent();
		}
		/// <summary>
		/// 获取本窗体的实例
		/// </summary>
		/// <returns></returns>
		public static 人员信息维护 GetInstance(string ID)
		{
			if (_form == null || _form.IsDisposed)
			{
				lock (locker)
				{
					if (_form == null || _form.IsDisposed)
						_form = new 人员信息维护();
				}
			}

			if (ID == "new")
			{
				_form.CurrentRecord = new 人员();
				_form.IsCurrentRecordReadonly = false;
			}
			else
			{
				_form.CurrentRecord = Singleton<BL_人员>.GetInstance().GetEntity(ID);
				_form.IsCurrentRecordReadonly = true;
			}

			return _form;
		}
		#endregion

		#region 窗体事件
		/// <summary>
		/// 窗体载入事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void 人员信息维护_Load(object sender, EventArgs e)
		{
			部门班组选择.SelectionChanged += new EventHandler<NotifyEventArgs<部门>>(部门班组选择_SelectionChanged);
			//	显示基本信息
			tabControl.SelectedTab = tabPageBase;
			//	更新基本信息
			UpdateBaseView();
		}
		/// <summary>
		/// 窗体关闭事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void 人员信息维护_FormClosed(object sender, FormClosedEventArgs e)
		{
			部门班组选择.SelectionChanged -= new EventHandler<NotifyEventArgs<部门>>(部门班组选择_SelectionChanged);
		}
		#endregion

		#region 触发事件
		/// <summary>
		/// 将要选择选项卡事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tabControl_Selecting(object sender, TabControlCancelEventArgs e)
		{
			if (string.IsNullOrEmpty(CurrentRecord.ID) && e.TabPage != tabPageBase)
			{
				ShowErrorMessage("请先保存人员基本信息！");
				e.Cancel = true;
				return;
			}
		}
		/// <summary>
		/// 改变TabControl选择事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (tabControl.SelectedTab == tabPageBase)
			{
				UpdateBaseView();
			}
			else if (tabControl.SelectedTab == tabPage学历)
			{
				Update学历列表();
			}
			else if (tabControl.SelectedTab == tabPage取证)
			{
				Update证书列表();
			}
			else if (tabControl.SelectedTab == tabPage职称)
			{
				Update职称列表();
			}
			else if (tabControl.SelectedTab == tabPage职业资格)
			{
				Update职业资格列表();
			}
			else if (tabControl.SelectedTab == tabPage从业资格)
			{
				Update从业资格列表();
			}
			else if (tabControl.SelectedTab == tabPage执业资格)
			{
				Update执业资格列表();
			}
			else if (tabControl.SelectedTab == tabPage电工)
			{
				Update电工列表();
			}
			else if (tabControl.SelectedTab == tabPage厂内机动车)
			{
				Update厂内机动车列表();
			}
			else if (tabControl.SelectedTab == tabPage焊工)
			{
				Update焊工列表();
			}
			else if (tabControl.SelectedTab == tabPage起重)
			{
				Update起重列表();
			}
			else if (tabControl.SelectedTab == tabPage带电作业)
			{
				Update带电作业列表();
			}
			else if (tabControl.SelectedTab == tabPage电工进网)
			{
				Update电工进网列表();
			}
			else if (tabControl.SelectedTab == tabPage电力行政执法)
			{
				Update电力行政执法列表();
			}
			else if (tabControl.SelectedTab == tabPage概预算)
			{
				Update概预算列表();
			}
			else if (tabControl.SelectedTab == tabPage计量检定)
			{
				Update计量检定列表();
			}
			else if (tabControl.SelectedTab == tabPage用电检查)
			{
				Update用电检查列表();
			}
			else if (tabControl.SelectedTab == tabPage油气检查)
			{
				Update油气检查列表();
			}
			else if (tabControl.SelectedTab == tabPage管理)
			{
				Update管理列表();
			}
			else if (tabControl.SelectedTab == tabPage其他人员)
			{
				Update其他人员列表();
			}
			else if (tabControl.SelectedTab == tabPage安全技能)
			{
				Update安全技能列表();
			}
			else if (tabControl.SelectedTab == tabPage安规100)
			{
				Update安规100列表();
			}
			else if (tabControl.SelectedTab == tabPage三种人)
			{
				Update三种人列表();
			}
		}

		#region 基本信息
		/// <summary>
		/// 更新界面显示
		/// </summary>
		private void UpdateBaseView()
		{
			if (CurrentRecord == null)
				return;

			try
			{
				this.Text = string.Format("人员信息  姓名:{0}  工号:{1}", CurrentRecord.姓名, CurrentRecord.工号);

				//	姓名
				tbBaseName.Text = CurrentRecord.姓名;
				//	性别
				cbBaseSex.Text = CurrentRecord.性别;
				//	工号
				tbBaseNo.Text = CurrentRecord.工号;
				//	部门
				部门 department = Singleton<BL_部门>.GetInstance().GetEntity(CurrentRecord.部门班组ID);
				tbBaseDepart.Text = department == null ? string.Empty : department.路径;
				tbBaseDepart.Tag = CurrentRecord.部门班组ID;
				//	岗位
				tbBaseJob.Text = CurrentRecord.岗位;
				//	岗位代码
				tbBaseJobCode.Text = CurrentRecord.岗位代码;
				//	出生时间
				dtpBaseBirth.Value = CurrentRecord.出生时间.HasValue ? CurrentRecord.出生时间.Value : DateTime.Now;
				//	工作时间
				dtpBaseWork.Value = CurrentRecord.工作时间.HasValue ? CurrentRecord.工作时间.Value : DateTime.Now;
				//	身份证号码
				tbBaseIDNumber.Text = CurrentRecord.身份证号码;
				//	备注
				tbBaseRemark.Text = CurrentRecord.备注;
				//	照片
				if (CurrentRecord.照片 != null)
				{
					using (MemoryStream ms = new MemoryStream(CurrentRecord.照片))
					{
						ms.Position = 0;
						pictureBox.Image = CreateThumailImage(Image.FromStream(ms), pictureBox.Width - 2, pictureBox.Height - 2);
					}
				}
				else
				{
					pictureBox.Image = null;
				}

				//	控件只读状态
				foreach (Control ct in tabPageBase.Controls)
				{
					if (ct is TextBoxBase)
					{
						TextBoxBase tbb = ct as TextBoxBase;
						tbb.ReadOnly = IsCurrentRecordReadonly;
					}
					else if (ct is DateTimePicker || ct is PictureBox || ct is Button || ct is ComboBox)
					{
						ct.Enabled = !IsCurrentRecordReadonly;
					}
				}
				tbBaseDepart.ReadOnly = true;

				//	按钮状态
				tsbtBaseSave.Enabled = !IsCurrentRecordReadonly;
				btBaseSavePicture.Enabled = CurrentRecord.照片 != null;
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改基础信息
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbtBaseModify_Click(object sender, EventArgs e)
		{
			IsCurrentRecordReadonly = false;
			UpdateBaseView();
		}
		/// <summary>
		/// 部门选择
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tbBaseDepart_Click(object sender, EventArgs e)
		{
			if (IsCurrentRecordReadonly)
				return;

			try
			{
				部门班组选择 form = 部门班组选择.GetInstance();
				if (form == null)
					throw new Exception("无法获取部门班组选择窗体");

				form.ShowDialog(this);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 部门选择结果
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void 部门班组选择_SelectionChanged(object sender, NotifyEventArgs<部门> e)
		{
			if (IsCurrentRecordReadonly)
				return;

			try
			{
				tbBaseDepart.Text = e.value.路径;
				tbBaseDepart.Tag = e.value.ID;
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 检查基本信息输入
		/// </summary>
		/// <returns></returns>
		private bool CheckBaseInput()
		{
			if (string.IsNullOrEmpty(tbBaseName.Text.Trim()))
			{
				ShowMessageBox("姓名不能为空!");
				tbBaseName.Focus();
				return false;
			}

			if (string.IsNullOrEmpty(tbBaseNo.Text.Trim()))
			{
				ShowMessageBox("工号不能为空!");
				tbBaseNo.Focus();
				return false;
			}

			if (cbBaseSex.SelectedIndex < 0)
			{
				ShowMessageBox("请选择人员性别!");
				cbBaseSex.Focus();
				return false;
			}

			if (string.IsNullOrEmpty(tbBaseDepart.Text.Trim()))
			{
				ShowMessageBox("部门不能为空!");
				tbBaseDepart.Focus();
				return false;
			}

			if (string.IsNullOrEmpty(tbBaseJob.Text.Trim()))
			{
				ShowMessageBox("岗位不能为空!");
				tbBaseJob.Focus();
				return false;
			}

			if (string.IsNullOrEmpty(tbBaseJobCode.Text.Trim()))
			{
				ShowMessageBox("岗位代码不能为空!");
				tbBaseJobCode.Focus();
				return false;
			}

			if (string.IsNullOrEmpty(tbBaseIDNumber.Text.Trim()))
			{
				ShowMessageBox("身份证号码不能为空!");
				tbBaseIDNumber.Focus();
				return false;
			}

			return true;
		}
		/// <summary>
		/// 保存基础信息
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbtBaseSave_Click(object sender, EventArgs e)
		{
			if (!CheckBaseInput())
				return;

			try
			{
				//	姓名
				CurrentRecord.姓名 = tbBaseName.Text.Trim();
				//	工号
				CurrentRecord.工号 = tbBaseNo.Text.Trim();
				//	性别
				CurrentRecord.性别 = cbBaseSex.Text;
				//	部门
				CurrentRecord.部门班组ID = tbBaseDepart.Tag as string;
				//	岗位
				CurrentRecord.岗位 = tbBaseJob.Text.Trim();
				//	岗位代码
				CurrentRecord.岗位代码 = tbBaseJobCode.Text.Trim();
				//	出生时间
				CurrentRecord.出生时间 = dtpBaseBirth.Value;
				//	工作时间
				CurrentRecord.工作时间 = dtpBaseWork.Value;
				//	身份证号码
				CurrentRecord.身份证号码 = tbBaseIDNumber.Text.Trim();
				//	备注
				CurrentRecord.备注 = tbBaseRemark.Text.Trim();
				////	照片
				//if (pictureBox.Image != null)
				//{
				//    using (MemoryStream ms = new MemoryStream())
				//    {
				//        pictureBox.Image.Save(ms, ImageFormat.Jpeg);
				//        CurrentRecord.照片 = ms.ToArray();
				//    }
				//}

				if (Singleton<BL_人员>.GetInstance().Save(CurrentRecord))
				{
					ShowSuccessMessage("人员信息已保存!");
					DialogResult = DialogResult.OK;
					this.Close();
				}
				else
				{
					ShowErrorMessage("保存人员信息时发生错误!");
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 选择照片
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btBaseSelectPicture_Click(object sender, EventArgs e)
		{
			try
			{
				//	默认从我的文档选择照片
				openFileDialogBase.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
				//	过滤器
				openFileDialogBase.Filter = "所有支持的图像格式 (*.jpg;*.jpeg;*.bmp;*.png;*.gif)|*.jpg;*.jpeg;*.bmp;*.png;*.gif";

				if (openFileDialogBase.ShowDialog(this) == DialogResult.OK)
				{
					//	显示选择的图片
					using (Image img = Image.FromFile(openFileDialogBase.FileName))
					{
						//	显示缩放后的图片
						pictureBox.Image = CreateThumailImage(img, pictureBox.Width - 2, pictureBox.Height - 2);

						using (MemoryStream ms = new MemoryStream())
						{
							img.Save(ms, ImageFormat.Jpeg);
							CurrentRecord.照片 = ms.ToArray();
						}
					}
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 保存照片
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btBaseSavePicture_Click(object sender, EventArgs e)
		{
			if (CurrentRecord == null || CurrentRecord.照片 == null)
				return;

			try
			{
				//	默认从我的文档选择照片
				saveFileDialogBase.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
				//	过滤器
				saveFileDialogBase.Filter = "jpg文件(*.jpg)|*.jpg";
				//	默认文件名
				saveFileDialogBase.FileName = "照片.jpg"; ;

				if (saveFileDialogBase.ShowDialog(this) == DialogResult.OK)
				{
					using (FileStream fs = new FileStream(saveFileDialogBase.FileName, FileMode.Create, FileAccess.Write, FileShare.None))
					{
						fs.Write(CurrentRecord.照片, 0, CurrentRecord.照片.Length);
						fs.Flush();
						fs.Close();
					}
					//	启动图片查看程序显示图片
					Process.Start(saveFileDialogBase.FileName);
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		#endregion

		#region 学历
		/// <summary>
		/// 更新学历列表
		/// </summary>
		private void Update学历列表()
		{
			try
			{
				dgv学历.AutoGenerateColumns = false;
				dgv学历.DataSource = Singleton<BL_学历>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv学历_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv学历.Rows[e.RowIndex].Cells[Column学历ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				学历信息维护 form = 学历信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建学历维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update学历列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt学历新增_Click(object sender, EventArgs e)
		{
			try
			{
				学历信息维护 form = 学历信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建学历维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update学历列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt学历修改_Click(object sender, EventArgs e)
		{
			if (dgv学历.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv学历.SelectedRows[0].Cells[Column学历ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				学历信息维护 form = 学历信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建学历维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update学历列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt学历删除_Click(object sender, EventArgs e)
		{
			if (dgv学历.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv学历.SelectedRows[0].Cells[Column学历ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_学历>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update学历列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt学历刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update学历列表();
		}
		#endregion

		#region 证书
		/// <summary>
		/// 更新证书列表
		/// </summary>
		private void Update证书列表()
		{
			try
			{
				dgv证书.AutoGenerateColumns = false;
				dgv证书.DataSource = Singleton<BL_取证>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv证书_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv证书.Rows[e.RowIndex].Cells[Column证书ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				取证信息维护 form = 取证信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建学历维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update证书列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt证书新增_Click(object sender, EventArgs e)
		{
			try
			{
				取证信息维护 form = 取证信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建证书维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update证书列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt证书修改_Click(object sender, EventArgs e)
		{
			if (dgv证书.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv证书.SelectedRows[0].Cells[Column证书ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				取证信息维护 form = 取证信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建学历维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update证书列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt证书删除_Click(object sender, EventArgs e)
		{
			if (dgv证书.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv证书.SelectedRows[0].Cells[Column证书ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_取证>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update证书列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt证书刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update证书列表();
		}
		#endregion

		#region 职业_职称
		/// <summary>
		/// 更新职称列表
		/// </summary>
		private void Update职称列表()
		{
			try
			{
				dgv职称.AutoGenerateColumns = false;
				dgv职称.DataSource = Singleton<BL_职称>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv职称_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv职称.Rows[e.RowIndex].Cells[Column职称ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				职称信息维护 form = 职称信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建职称维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update职称列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职称新增_Click(object sender, EventArgs e)
		{
			try
			{
				职称信息维护 form = 职称信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建职称维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update职称列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职称修改_Click(object sender, EventArgs e)
		{
			if (dgv职称.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv职称.SelectedRows[0].Cells[Column职称ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				职称信息维护 form = 职称信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建职称维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update职称列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职称删除_Click(object sender, EventArgs e)
		{
			if (dgv职称.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv职称.SelectedRows[0].Cells[Column职称ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_职称>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update职称列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职称刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update职称列表();
		} 
		#endregion

		#region 职业资格
		/// <summary>
		/// 更新职业资格列表
		/// </summary>
		private void Update职业资格列表()
		{
			try
			{
				dgv职业资格.AutoGenerateColumns = false;
				dgv职业资格.DataSource = Singleton<BL_职业资格>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv职业资格_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv职业资格.Rows[e.RowIndex].Cells[Column职业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				职业资格信息维护 form = 职业资格信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建职业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update职业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职业资格新增_Click(object sender, EventArgs e)
		{
			try
			{
				职业资格信息维护 form = 职业资格信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建职业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update职业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职业资格修改_Click(object sender, EventArgs e)
		{
			if (dgv职业资格.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv职业资格.SelectedRows[0].Cells[Column职业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				职业资格信息维护 form = 职业资格信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建职业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update职业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职业资格删除_Click(object sender, EventArgs e)
		{
			if (dgv职业资格.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv职业资格.SelectedRows[0].Cells[Column职业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_职业资格>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update职业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt职业资格刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update职业资格列表();
		} 
		#endregion

		#region 从业资格
		/// <summary>
		/// 更新从业资格列表
		/// </summary>
		private void Update从业资格列表()
		{
			try
			{
				dgv从业资格.AutoGenerateColumns = false;
				dgv从业资格.DataSource = Singleton<BL_从业资格>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv从业资格_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv从业资格.Rows[e.RowIndex].Cells[Column从业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				从业资格信息维护 form = 从业资格信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建从业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update从业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt从业资格新增_Click(object sender, EventArgs e)
		{
			try
			{
				从业资格信息维护 form = 从业资格信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建从业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update从业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt从业资格修改_Click(object sender, EventArgs e)
		{
			if (dgv从业资格.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv从业资格.SelectedRows[0].Cells[Column从业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				从业资格信息维护 form = 从业资格信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建从业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update从业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt从业资格删除_Click(object sender, EventArgs e)
		{
			if (dgv从业资格.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv从业资格.SelectedRows[0].Cells[Column从业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_从业资格>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update从业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt从业资格刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update从业资格列表();
		}
		#endregion

		#region 执业资格
		/// <summary>
		/// 更新执业资格列表
		/// </summary>
		private void Update执业资格列表()
		{
			try
			{
				dgv执业资格.AutoGenerateColumns = false;
				dgv执业资格.DataSource = Singleton<BL_执业资格>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv执业资格_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv执业资格.Rows[e.RowIndex].Cells[Column执业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				执业资格信息维护 form = 执业资格信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建执业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update执业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt执业资格新增_Click(object sender, EventArgs e)
		{
			try
			{
				执业资格信息维护 form = 执业资格信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建执业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update执业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt执业资格修改_Click(object sender, EventArgs e)
		{
			if (dgv执业资格.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv执业资格.SelectedRows[0].Cells[Column执业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				执业资格信息维护 form = 执业资格信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建执业资格维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update执业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt执业资格删除_Click(object sender, EventArgs e)
		{
			if (dgv执业资格.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv执业资格.SelectedRows[0].Cells[Column执业资格ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_执业资格>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update执业资格列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt执业资格刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update执业资格列表();
		}
		#endregion

		#region 电工
		/// <summary>
		/// 更新电工列表
		/// </summary>
		private void Update电工列表()
		{
			try
			{
				dgv电工.AutoGenerateColumns = false;
				dgv电工.DataSource = Singleton<BL_电工>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv电工_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv电工.Rows[e.RowIndex].Cells[Column电工ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				电工信息维护 form = 电工信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电工维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工新增_Click(object sender, EventArgs e)
		{
			try
			{
				电工信息维护 form = 电工信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电工维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工修改_Click(object sender, EventArgs e)
		{
			if (dgv电工.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv电工.SelectedRows[0].Cells[Column电工ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				电工信息维护 form = 电工信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电工维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工删除_Click(object sender, EventArgs e)
		{
			if (dgv电工.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv电工.SelectedRows[0].Cells[Column电工ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_电工>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update电工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update电工列表();
		}
		#endregion

		#region 厂内机动车
		/// <summary>
		/// 更新厂内机动车列表
		/// </summary>
		private void Update厂内机动车列表()
		{
			try
			{
				dgv厂内机动车.AutoGenerateColumns = false;
				dgv厂内机动车.DataSource = Singleton<BL_厂内机动车>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv厂内机动车_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv厂内机动车.Rows[e.RowIndex].Cells[Column厂内机动车ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				厂内机动车信息维护 form = 厂内机动车信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建厂内机动车维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update厂内机动车列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt厂内机动车新增_Click(object sender, EventArgs e)
		{
			try
			{
				厂内机动车信息维护 form = 厂内机动车信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建厂内机动车维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update厂内机动车列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt厂内机动车修改_Click(object sender, EventArgs e)
		{
			if (dgv厂内机动车.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv厂内机动车.SelectedRows[0].Cells[Column厂内机动车ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				厂内机动车信息维护 form = 厂内机动车信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建厂内机动车维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update厂内机动车列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt厂内机动车删除_Click(object sender, EventArgs e)
		{
			if (dgv厂内机动车.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv厂内机动车.SelectedRows[0].Cells[Column厂内机动车ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_厂内机动车>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update厂内机动车列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt厂内机动车刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update厂内机动车列表();
		}
		#endregion

		#region 焊工
		/// <summary>
		/// 更新焊工列表
		/// </summary>
		private void Update焊工列表()
		{
			try
			{
				dgv焊工.AutoGenerateColumns = false;
				dgv焊工.DataSource = Singleton<BL_焊工>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv焊工_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv焊工.Rows[e.RowIndex].Cells[Column焊工ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				焊工信息维护 form = 焊工信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建焊工维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update焊工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt焊工新增_Click(object sender, EventArgs e)
		{
			try
			{
				焊工信息维护 form = 焊工信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建焊工维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update焊工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt焊工修改_Click(object sender, EventArgs e)
		{
			if (dgv焊工.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv焊工.SelectedRows[0].Cells[Column焊工ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				焊工信息维护 form = 焊工信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建焊工维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update焊工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt焊工删除_Click(object sender, EventArgs e)
		{
			if (dgv焊工.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv焊工.SelectedRows[0].Cells[Column焊工ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_焊工>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update焊工列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt焊工刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update焊工列表();
		}
		#endregion

		#region 起重
		/// <summary>
		/// 更新起重列表
		/// </summary>
		private void Update起重列表()
		{
			try
			{
				dgv起重.AutoGenerateColumns = false;
				dgv起重.DataSource = Singleton<BL_起重>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv起重_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv起重.Rows[e.RowIndex].Cells[Column起重ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				起重信息维护 form = 起重信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建起重维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update起重列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt起重新增_Click(object sender, EventArgs e)
		{
			try
			{
				起重信息维护 form = 起重信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建起重维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update起重列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt起重修改_Click(object sender, EventArgs e)
		{
			if (dgv起重.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv起重.SelectedRows[0].Cells[Column起重ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				起重信息维护 form = 起重信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建起重维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update起重列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt起重删除_Click(object sender, EventArgs e)
		{
			if (dgv起重.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv起重.SelectedRows[0].Cells[Column起重ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_起重>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update起重列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt起重刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update起重列表();
		}
		#endregion

		#region 带电作业
		/// <summary>
		/// 更新带电作业列表
		/// </summary>
		private void Update带电作业列表()
		{
			try
			{
				dgv带电作业.AutoGenerateColumns = false;
				dgv带电作业.DataSource = Singleton<BL_带电作业>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv带电作业_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv带电作业.Rows[e.RowIndex].Cells[Column带电作业ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				带电作业信息维护 form = 带电作业信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建带电作业维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update带电作业列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt带电作业新增_Click(object sender, EventArgs e)
		{
			try
			{
				带电作业信息维护 form = 带电作业信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建带电作业维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update带电作业列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt带电作业修改_Click(object sender, EventArgs e)
		{
			if (dgv带电作业.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv带电作业.SelectedRows[0].Cells[Column带电作业ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				带电作业信息维护 form = 带电作业信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建带电作业维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update带电作业列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt带电作业删除_Click(object sender, EventArgs e)
		{
			if (dgv带电作业.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv带电作业.SelectedRows[0].Cells[Column带电作业ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_带电作业>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update带电作业列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt带电作业刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update带电作业列表();
		}
		#endregion

		#region 电工进网
		/// <summary>
		/// 更新电工进网列表
		/// </summary>
		private void Update电工进网列表()
		{
			try
			{
				dgv电工进网.AutoGenerateColumns = false;
				dgv电工进网.DataSource = Singleton<BL_电工进网>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv电工进网_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv电工进网.Rows[e.RowIndex].Cells[Column电工进网ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				电工进网信息维护 form = 电工进网信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电工进网维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电工进网列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工进网新增_Click(object sender, EventArgs e)
		{
			try
			{
				电工进网信息维护 form = 电工进网信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电工进网维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电工进网列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工进网修改_Click(object sender, EventArgs e)
		{
			if (dgv电工进网.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv电工进网.SelectedRows[0].Cells[Column电工进网ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				电工进网信息维护 form = 电工进网信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电工进网维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电工进网列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工进网删除_Click(object sender, EventArgs e)
		{
			if (dgv电工进网.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv电工进网.SelectedRows[0].Cells[Column电工进网ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_电工进网>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update电工进网列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电工进网刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update电工进网列表();
		}
		#endregion

		#region 电力行政执法
		/// <summary>
		/// 更新电力行政执法列表
		/// </summary>
		private void Update电力行政执法列表()
		{
			try
			{
				dgv电力行政执法.AutoGenerateColumns = false;
				dgv电力行政执法.DataSource = Singleton<BL_电力行政执法>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv电力行政执法_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv电力行政执法.Rows[e.RowIndex].Cells[Column电力行政执法ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				电力行政执法信息维护 form = 电力行政执法信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电力行政执法维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电力行政执法列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电力行政执法新增_Click(object sender, EventArgs e)
		{
			try
			{
				电力行政执法信息维护 form = 电力行政执法信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电力行政执法维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电力行政执法列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电力行政执法修改_Click(object sender, EventArgs e)
		{
			if (dgv电力行政执法.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv电力行政执法.SelectedRows[0].Cells[Column电力行政执法ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				电力行政执法信息维护 form = 电力行政执法信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建电力行政执法维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update电力行政执法列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电力行政执法删除_Click(object sender, EventArgs e)
		{
			if (dgv电力行政执法.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv电力行政执法.SelectedRows[0].Cells[Column电力行政执法ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_电力行政执法>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update电力行政执法列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt电力行政执法刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update电力行政执法列表();
		}
		#endregion

		#region 概预算
		/// <summary>
		/// 更新概预算列表
		/// </summary>
		private void Update概预算列表()
		{
			try
			{
				dgv概预算.AutoGenerateColumns = false;
				dgv概预算.DataSource = Singleton<BL_概预算>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv概预算_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv概预算.Rows[e.RowIndex].Cells[Column概预算ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				概预算信息维护 form = 概预算信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建概预算维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update概预算列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt概预算新增_Click(object sender, EventArgs e)
		{
			try
			{
				概预算信息维护 form = 概预算信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建概预算维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update概预算列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt概预算修改_Click(object sender, EventArgs e)
		{
			if (dgv概预算.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv概预算.SelectedRows[0].Cells[Column概预算ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				概预算信息维护 form = 概预算信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建概预算维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update概预算列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt概预算删除_Click(object sender, EventArgs e)
		{
			if (dgv概预算.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv概预算.SelectedRows[0].Cells[Column概预算ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_概预算>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update概预算列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt概预算刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update概预算列表();
		}
		#endregion

		#region 计量检定
		/// <summary>
		/// 更新计量检定列表
		/// </summary>
		private void Update计量检定列表()
		{
			try
			{
				dgv计量检定.AutoGenerateColumns = false;
				dgv计量检定.DataSource = Singleton<BL_计量检定>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv计量检定_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv计量检定.Rows[e.RowIndex].Cells[Column计量检定ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				计量检定信息维护 form = 计量检定信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建计量检定维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update计量检定列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt计量检定新增_Click(object sender, EventArgs e)
		{
			try
			{
				计量检定信息维护 form = 计量检定信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建计量检定维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update计量检定列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt计量检定修改_Click(object sender, EventArgs e)
		{

		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt计量检定删除_Click(object sender, EventArgs e)
		{
			if (dgv计量检定.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv计量检定.SelectedRows[0].Cells[Column计量检定ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_计量检定>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update计量检定列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt计量检定刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update计量检定列表();
		}
		#endregion

		#region 用电检查
		/// <summary>
		/// 更新用电检查列表
		/// </summary>
		private void Update用电检查列表()
		{
			try
			{
				dgv用电检查.AutoGenerateColumns = false;
				dgv用电检查.DataSource = Singleton<BL_用电检查>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv用电检查_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv用电检查.Rows[e.RowIndex].Cells[Column用电检查ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				用电检查信息维护 form = 用电检查信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建用电检查维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update用电检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt用电检查新增_Click(object sender, EventArgs e)
		{
			try
			{
				用电检查信息维护 form = 用电检查信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建用电检查维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update用电检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt用电检查修改_Click(object sender, EventArgs e)
		{
			if (dgv用电检查.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv用电检查.SelectedRows[0].Cells[Column用电检查ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				用电检查信息维护 form = 用电检查信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建用电检查维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update用电检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt用电检查删除_Click(object sender, EventArgs e)
		{
			if (dgv用电检查.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv用电检查.SelectedRows[0].Cells[Column用电检查ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_用电检查>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update用电检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt用电检查刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update用电检查列表();
		}
		#endregion

		#region 油气检查
		/// <summary>
		/// 更新油气检查列表
		/// </summary>
		private void Update油气检查列表()
		{
			try
			{
				dgv油气检查.AutoGenerateColumns = false;
				dgv油气检查.DataSource = Singleton<BL_油气检查>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv油气检查_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv油气检查.Rows[e.RowIndex].Cells[Column油气检查ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				油气检查信息维护 form = 油气检查信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建油气检查维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update油气检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt油气检查新增_Click(object sender, EventArgs e)
		{
			try
			{
				油气检查信息维护 form = 油气检查信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建油气检查维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update油气检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt油气检查修改_Click(object sender, EventArgs e)
		{
			if (dgv油气检查.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv油气检查.SelectedRows[0].Cells[Column油气检查ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				油气检查信息维护 form = 油气检查信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建油气检查维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update油气检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt油气检查删除_Click(object sender, EventArgs e)
		{
			if (dgv油气检查.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv油气检查.SelectedRows[0].Cells[Column油气检查ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_油气检查>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update油气检查列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt油气检查刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update油气检查列表();
		}
		#endregion

		#region 管理
		/// <summary>
		/// 更新管理列表
		/// </summary>
		private void Update管理列表()
		{
			try
			{
				dgv管理.AutoGenerateColumns = false;
				dgv管理.DataSource = Singleton<BL_管理>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv管理_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv管理.Rows[e.RowIndex].Cells[Column管理ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				管理信息维护 form = 管理信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建管理维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update管理列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt管理新增_Click(object sender, EventArgs e)
		{
			try
			{
				管理信息维护 form = 管理信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建管理维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update管理列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt管理修改_Click(object sender, EventArgs e)
		{
			if (dgv管理.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv管理.SelectedRows[0].Cells[Column管理ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				管理信息维护 form = 管理信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建管理维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update管理列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt管理删除_Click(object sender, EventArgs e)
		{
			if (dgv管理.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv管理.SelectedRows[0].Cells[Column管理ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_管理>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update管理列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt管理刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update管理列表();
		}
		#endregion

		#region 其他人员
		/// <summary>
		/// 更新其他人员列表
		/// </summary>
		private void Update其他人员列表()
		{
			try
			{
				dgv其他人员.AutoGenerateColumns = false;
				dgv其他人员.DataSource = Singleton<BL_其他人员>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv其他人员_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv其他人员.Rows[e.RowIndex].Cells[Column其他人员ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				其他人员信息维护 form = 其他人员信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建其他人员维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update其他人员列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt其他人员新增_Click(object sender, EventArgs e)
		{
			try
			{
				其他人员信息维护 form = 其他人员信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建其他人员维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update其他人员列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt其他人员修改_Click(object sender, EventArgs e)
		{
			if (dgv其他人员.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv其他人员.SelectedRows[0].Cells[Column其他人员ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				其他人员信息维护 form = 其他人员信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建其他人员维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update其他人员列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt其他人员删除_Click(object sender, EventArgs e)
		{
			if (dgv其他人员.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv其他人员.SelectedRows[0].Cells[Column其他人员ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_其他人员>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update其他人员列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt其他人员刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update其他人员列表();
		}
		#endregion

		#region 安全技能
		/// <summary>
		/// 更新安全技能列表
		/// </summary>
		private void Update安全技能列表()
		{
			try
			{
				dgv安全技能.AutoGenerateColumns = false;
				dgv安全技能.DataSource = Singleton<BL_安全技能>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv安全技能_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv安全技能.Rows[e.RowIndex].Cells[Column安全技能ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				安全技能信息维护 form = 安全技能信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建安全技能维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update安全技能列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安全技能新增_Click(object sender, EventArgs e)
		{
			try
			{
				安全技能信息维护 form = 安全技能信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建安全技能维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update安全技能列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安全技能修改_Click(object sender, EventArgs e)
		{
			if (dgv安全技能.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv安全技能.SelectedRows[0].Cells[Column安全技能ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				安全技能信息维护 form = 安全技能信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建安全技能维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update安全技能列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安全技能删除_Click(object sender, EventArgs e)
		{
			if (dgv安全技能.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv安全技能.SelectedRows[0].Cells[Column安全技能ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_安全技能>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update安全技能列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安全技能刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update安全技能列表();
		}
		#endregion

		#region 安规100
		/// <summary>
		/// 更新安规100列表
		/// </summary>
		private void Update安规100列表()
		{
			try
			{
				dgv安规100.AutoGenerateColumns = false;
				dgv安规100.DataSource = Singleton<BL_安规100>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv安规100_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv安规100.Rows[e.RowIndex].Cells[Column安规100ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				安规100信息维护 form = 安规100信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建安规100维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update安规100列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安规100新增_Click(object sender, EventArgs e)
		{
			try
			{
				安规100信息维护 form = 安规100信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建安规100维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update安规100列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安规100修改_Click(object sender, EventArgs e)
		{
			if (dgv安规100.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv安规100.SelectedRows[0].Cells[Column安规100ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				安规100信息维护 form = 安规100信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建安规100维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update安规100列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安规100删除_Click(object sender, EventArgs e)
		{
			if (dgv安规100.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv安规100.SelectedRows[0].Cells[Column安规100ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_安规100>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update安规100列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt安规100刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update安规100列表();
		}
		#endregion

		#region 三种人
		/// <summary>
		/// 更新三种人列表
		/// </summary>
		private void Update三种人列表()
		{
			try
			{
				dgv三种人.AutoGenerateColumns = false;
				dgv三种人.DataSource = Singleton<BL_三种人>.GetInstance().Query(CurrentRecord.ID);
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 列表双击
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgv三种人_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (e.RowIndex < 0)
				return;

			try
			{
				string ID = dgv三种人.Rows[e.RowIndex].Cells[Column三种人ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				三种人信息维护 form = 三种人信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建三种人维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update三种人列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 新增
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt三种人新增_Click(object sender, EventArgs e)
		{
			try
			{
				三种人信息维护 form = 三种人信息维护.GetInstance("new", CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建三种人维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update三种人列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt三种人修改_Click(object sender, EventArgs e)
		{
			if (dgv三种人.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要修改的记录!");
				return;
			}

			try
			{
				string ID = dgv三种人.SelectedRows[0].Cells[Column三种人ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				三种人信息维护 form = 三种人信息维护.GetInstance(ID, CurrentRecord.ID);
				if (form == null)
					throw new Exception("无法创建三种人维护窗体!");

				if (form.ShowDialog(this) == DialogResult.OK)
				{
					//	更新列表
					Update三种人列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt三种人删除_Click(object sender, EventArgs e)
		{
			if (dgv三种人.SelectedRows.Count == 0)
			{
				ShowErrorMessage("请选择要删除的记录!");
				return;
			}

			try
			{
				string ID = dgv三种人.SelectedRows[0].Cells[Column三种人ID.Index].Value as string;
				if (string.IsNullOrEmpty(ID))
					return;

				if (ShowYesNoMessage("删除该记录吗?") != DialogResult.Yes)
					return;

				//	删除
				if (Singleton<BL_三种人>.GetInstance().Delete(ID))
				{
					ShowSuccessMessage("所选记录已删除!");
					//	更新列表
					Update三种人列表();
				}
			}
			catch (Exception ex)
			{
				ShowExceptionMessage(ex);
			}
		}
		/// <summary>
		/// 刷新
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tsbt三种人刷新_Click(object sender, EventArgs e)
		{
			//	更新列表
			Update三种人列表();
		}
		#endregion
		#endregion
	}
}